package com.oracle.controller;

import com.oracle.common.PageResult;
import com.oracle.common.R;
import com.oracle.pojo.Gly;
import com.oracle.service.GlyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RestController
@RequestMapping("/gly")
public class    GlyController {

    @Autowired
    private GlyService glyService;

    @GetMapping("/find")
    public List<Gly> findList(){

        List<Gly> list=glyService.findList();
        return list;
    }

    @PostMapping("find2")
    public R<Gly> findPages2(@RequestBody Gly gly, Integer pageNo, Integer pageSize)
    {
        if(ObjectUtils.isEmpty(pageNo)){
            pageNo = 1;
        }

        if(ObjectUtils.isEmpty(pageSize)){
            pageSize = 10;
        }

        PageResult pages = glyService.findPages(pageNo, pageSize,gly);
        return R.success(pages);
    }
}
